package zuoye;

import util.Util;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Savejpanel extends JPanel implements ActionListener {
    private Icon sureimage = Util.getIcon("/images/buttonSure.jpg");
    private Icon offimage = Util.getIcon("/images/buttonOff.jpg");
    private JButton SurejButton;
    private JButton OffjButton;
    private Mainjframe frame;

    public Savejpanel(Mainjframe frame) {
        this.frame = frame;
        this.setLayout(null);
        this.setOpaque(false);

        JLabel jLabel = new JLabel("请输入存款金额：");
        jLabel.setForeground(Color.BLACK);
        jLabel.setFont(new Font("宋体",Font.BOLD,22));
        jLabel.setBounds(340, 420, 200, 40);
        this.add(jLabel);

        JTextField textField1 = new JTextField();
        textField1.setBounds(550, 420, 350, 40);
        this.add(textField1);

        SurejButton = new JButton(sureimage);
        SurejButton.setBounds(360, 500, 140, 50);
        this.add(SurejButton);
        SurejButton.addActionListener(this);
        OffjButton = new JButton(offimage);
        OffjButton.setBounds(700, 500, 140, 50);
        this.add(OffjButton);
        OffjButton.addActionListener(this);

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == SurejButton) {
            frame.switchPanel("Save");
        } else if (e.getSource() == OffjButton) {
            frame.switchPanel("menu");
        }
    }
}
